package com.brspace.qualitycontrol.controller.admin;


import com.brspace.qualitycontrol.entity.ProcessRouter;
import com.brspace.qualitycontrol.service.ProcessRouterService;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;


/**
 * <p>
 *  流程路由
 * </p>
 *
 * @author Hugo
 * @since 2021-03-22
 */
@Api(description = "流程路由")
@RestController
@RequestMapping("/admin/process/router")
public class RouterController {

    @Resource
    private ProcessRouterService routerService;
    /**
     * 保存
     * @Params router
     * @return NULL
     */
    @PostMapping("save")
    public R saveRouter(ProcessRouter router){
        routerService.saveRouter(router);
        return R.ok();
    }

    /**
     * 添加流程路由
     * @param router
     * @return
     */
    @ApiOperation("添加流程路由")
    @PostMapping("addRouter")
    public R addRouter(@ApiParam("路由对象")@RequestBody ProcessRouter router){
        routerService.saveRouter(router);
        return R.ok();
    }

}

